package com.lgj.demo0812.TestDemo;


import com.google.common.collect.Lists;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @author lizy51
 * @date 2022-08-16 17:41
 */
public class Demo01 {
    public static void main(String[] args) throws Exception {
//        Random rand = new Random();
//        rand.nextInt(9);
//        String s = "123";
//        System.out.printf("成绩为：%d%s %n  恭喜过关",100,"分");
        List<Integer> list = new ArrayList<>();
        List<Integer> list2 = new ArrayList<>();
        list.add(1);
        list.add(2);
//        list2.add(2);
//        BeanUtils.copyProperties(list, list2);
        PropertyUtils.copyProperties(list,list2);
        System.out.println(list2);
        System.out.println(list);
//        System.out.println(convertListToList(list, String.class));

    }
/*    public static <E, T> List<T> convertListToList(List<E> input, Class<T> clzz) {
        List<T> output = Lists.newArrayList();
        if (CollectionUtils.isNotEmpty(input)) {
            input.forEach(source -> {
                T target = BeanUtils.instantiate(clzz);
//                BeanUtils.instantiate(clzz);
                BeanUtils.copyProperties(source, target);
                output.add(target);
            });
        }
        return output;
    }*/
}
